import { View, Text } from "@tarojs/components";
// eslint-disable-next-line import/first
import { Gem } from '@/types/global';
import "./index.less";

interface BlackBagProps {
  blackBag?: Gem[]; // 从房间资源传入的黑袋宝石列表
}

export default function BlackBag({ blackBag }: BlackBagProps) {
  // 如果没有传入黑袋数据，则使用默认数据
  const getBlackBagCount = (): number => {
    if (blackBag) {
      return blackBag.length;
    }
    return 0; // 默认黑袋中没有宝石
  };

  const blackBagCount = getBlackBagCount();

  return (
    <View className='blackBagContainer'>
      <View className='bag-icon'>👜</View>
      <Text className='bag-label'>黑袋 ({blackBagCount})</Text>
    </View>
  );
}